/**
 * Created by Administrator on 2017/1/7.
 */
function displayCitations() {
    var supported = !document.getElementsByTagName || !document.createElement || !document.createTextNode;
    if (supported) {
        return false;
    }

    var quotes = document.getElementsByTagName('blockquote');
    for (var i = 0; i < quotes.length; i++) {
        var url = quotes[i].getAttribute('cite');
        if (!url) {
            continue;
        }

        var quoteChildren = quotes[i].getElementsByTagName('*');
        if (quoteChildren.length < 1) {
            continue;
        }

        var elem = quoteChildren[quoteChildren.length - 1];
        var link = document.createElement('a');
        var text = document.createTextNode('source');
        link.appendChild(text);
        link.setAttribute('href', url);

        var superscript = document.createElement('sup');
        superscript.appendChild(link);
        elem.appendChild(superscript);
    }
}

addLoadEvent(displayCitations);